package HomeElements;

import android.support.test.uiautomator.UiDevice;
import android.support.test.uiautomator.UiObject2;
import android.support.test.uiautomator.UiWatcher;

/**
 * Created by zhe.xiao on 2017/6/23.
 */

import static util.GetDevice.getDevice;
import static HomeElements.TanElements.*;

public class Watchers {
    UiDevice device = getDevice();

    public static class HomeW implements UiWatcher{
        @Override
        public boolean checkForCondition(){
            UiObject2 s = shengJiElement();
            UiObject2 g = shengJiCloseElement();
            if(s != null && g != null){
                g.click();
                return true;
            }
            return false;
        }
    }

    public static class JieJISongW1 implements UiWatcher{
        @Override
        public boolean checkForCondition(){
            UiObject2 e1 = jiJingSongTanElement();
            UiObject2 e2 = jieJiSongCloseElement();
            if(e1 != null){
                e2.click();
                return true;
            }
            return false;
        }
    }
    public static class JieJISongW2 implements UiWatcher{
        @Override
        public boolean checkForCondition(){
            UiObject2 e1 = jieJiSongZhiElement();
            if(e1 != null){
                e1.click();
                return true;
            }
            return false;
        }
    }

    public static class HomeTan implements UiWatcher{
        @Override
        public boolean checkForCondition(){
            UiObject2 u2 = homeTan();
            if(u2 != null){
                u2.click();
                return true;
            }
            return false;
        }
    }
}
